'''
Created on 26.08.2009

@author: sauron
'''
import sys
import pexpect

def main():
    print "main!"

def get_quota(username):
    (output,exitstatus)=pexpect.run("quota -w "+username , withexitstatus=1 )
    quota=output.splitlines()
    if len(quota) > 1:
        return quota[2].split()

def set_quota(username,diskquota,filequota):
    diskquota = str(diskquota)
    filequota = str(filequota)
    (output,exitstatus)=pexpect.run("setquota "+username+" "
        +diskquota+" "+diskquota+" "+filequota+" "+filequota+" -a" , withexitstatus=1 )
    if not exitstatus:
        return True
    else:
        return False

if __name__ == "__main__":
    main()
